/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ivanbiz.user;

import com.ivanbiz.tools.MD5;
import com.ivanbiz.tools.RandomList;
import java.util.List;

/**
 *
 * @author User
 */
public class UserServiceImpl implements UserService {

    private UserDAO userDAO;

    public void setUserDAO(UserDAO userDAO) {
        this.userDAO = userDAO;
    }
    
    
    public void saveUser(User user) throws Exception {       
        this.userDAO.save(user);
    }

    public void deleteUser(User user) throws Exception {
        this.userDAO.delete(user);
    }

    public void updateUser(User user) throws Exception {
        this.userDAO.update(user);
    }

    public List loadAll() throws Exception {
        return this.userDAO.getAll(User.class);
    }

    public User loadById(long id) throws Exception {
        return (User)this.userDAO.load(User.class, id);
    }

    public boolean cekIsEmptyUserId(String userId) throws Exception {
        return this.userDAO.cekIsEmptyUserId(userId);
    }

    public User login(String userName, String password, long departementId) throws Exception {
        return this.userDAO.login(userName, password, departementId);
    }
}
